package com.sh.caryr.erp.util;

import java.util.HashMap;
import java.util.Map;

public class ERPConstants {

    /****************************** System configure ************************/
    public static final String PROJECT_NAME = "RERP";
    public static final String ROUTE_MATERIAL = "erp";
    public static final String SYS_SUPER_USERNAME = "lcr008";
    public static final String TEMP_FOLDER_NAME = "temp";
    /****************************** Object Id ************************/
    public static final int NEW_OBJECT_ID = -1;
    public static final int INVALID_ID = -2;

    public static final int ENITYT_INACTIVE = 0;
    public static final int ENITYT_ACTIVE = 1;
    /****************************** ERP Authority ************************/
    public static final String AUTH_TARGET_ALL = "all"; //For testing
    public static final String AUTH_TARGET_USER = "user";
    public static final String AUTH_TARGET_USERROLE = "userRole";
    public static final String AUTH_TARGET_SHOP = "shop";
    public static final String AUTH_TARGET_PRODUCT = "product";
    public static final String AUTH_TARGET_SKU = "sku";
    public static final String AUTH_TARGET_STORAGE = "storage";
    public static final String AUTH_TARGET_TRADE = "salesOrder";
    public static final String AUTH_TARGET_PROMAPPING = "productMapping";
    public static final String AUTH_TARGET_SOMAPPING = "sOMapping";
    public static final String AUTH_TARGET_PROCOMB = "productComb";
    public static final String AUTH_TARGET_STOCK = "stock";
    public static final String AUTH_TARGET_STOCK_HIS = "stockHis";
    public static final String AUTH_TARGET_COMBSTOCK = "productCombStock";
    public static final String AUTH_TARGET_SO = "orderSal";
    public static final String AUTH_TARGET_SO_HIS = "orderSalHis";
    public static final String AUTH_TARGET_MATERIAL = "material";
    public static final String AUTH_TARGET_MATERIAL_COMB = "materialComb";
    public static final String AUTH_TARGET_SYSTEMLOG = "systemLog";

    public static final String AUTH_ACTVT_READ = "read";
    public static final String AUTH_ACTVT_CREATE = "create";
    public static final String AUTH_ACTVT_DELETE = "delete";
    public static final String AUTH_ACTVT_UPDATE = "update";

    //---- trade auth
    public static final String AUTH_ACTVT_IMPORT = "import";
    public static final String AUTH_ACTVT_EXPORT = "export";
    public static final String AUTH_ACTVT_SUBMIT = "submit";
    public static final String AUTH_ACTVT_PACKING = "packing";
    public static final String AUTH_ACTVT_DELIVER = "deliver";
    public static final String AUTH_ACTVT_SIGNOFF = "signoff";
    public static final String AUTH_ACTVT_SETTLE = "settle";
    public static final String AUTH_ACTVT_CLOSE = "close";

    public static final String AUTH_FIELD_FIELD = "field";

    public static final String AUTH_VALUE_ALL = "all";
    public static final String AUTH_VALUE_ANY = "any";
    /****************************** ERP Attributes ************************/
    public static final String ATTR_USER = "user";
    public static final String ATTR_AUTHS = "auths";
    public static final String ATTR_ROLE_ID = "roleId";
    public static final String ATTR_LANG = "lang";
    /****************************** ERP Language ************************/
    public static final String LANG_CN = "cn";
    public static final String LANG_EN = "en";
    public static final String LANG_KR = "kr";
    /****************************** ERP Sales Order Status*****************/
    public static final String SO_STS_NEW = "so_status_new";
    public static final String SO_STS_SMT = "so_status_submit";
    public static final String SO_STS_DLV = "so_status_delivered";
    public static final String SO_STS_RED = "so_status_received";
    public static final String SO_STS_PYD = "so_status_paid";

    /****************************** External SO Status *******************/
    public static Map<String, String> EXT_SO_STAUTS_TM = new HashMap<String, String>();
    static {
        EXT_SO_STAUTS_TM.put("TRADE_NO_CREATE_PAY", SO_STS_NEW);        //没有创建支付宝交易
        EXT_SO_STAUTS_TM.put("WAIT_BUYER_PAY", SO_STS_NEW);            //等待买家付款
        EXT_SO_STAUTS_TM.put("WAIT_SELLER_SEND_GOODS", SO_STS_SMT);    //等待卖家发货
        EXT_SO_STAUTS_TM.put("WAIT_BUYER_CONFIRM_GOODS", SO_STS_DLV);    //等待买家确认收货
        EXT_SO_STAUTS_TM.put("TRADE_BUYER_SIGNED", SO_STS_PYD);            //买家已签收
        EXT_SO_STAUTS_TM.put("TRADE_FINISHED", SO_STS_PYD);                //交易成功
        EXT_SO_STAUTS_TM.put("TRADE_CLOSED", SO_STS_PYD);                //付款以后用户退款成功，交易自动关闭
        EXT_SO_STAUTS_TM.put("TRADE_CLOSED_BY_TAOBAO", null);            //付款以前，卖家或买家主动关闭交易,不要对此订单进行发货,切记啊！
    }
    public enum TmSoStatusMap {
        TRADE_NO_CREATE_PAY(SO_STS_NEW),    //没有创建支付宝交易
        WAIT_BUYER_PAY(SO_STS_NEW),    //等待买家付款
        WAIT_SELLER_SEND_GOODS(SO_STS_SMT),    //等待卖家发货
        WAIT_BUYER_CONFIRM_GOODS(SO_STS_DLV),    //等待买家确认收货
        TRADE_BUYER_SIGNED(SO_STS_RED),    //买家已签收
        TRADE_FINISHED(SO_STS_PYD),    //交易成功
        TRADE_CLOSED(SO_STS_PYD),    //付款以后用户退款成功，交易自动关闭
        TRADE_CLOSED_BY_TAOBAO(null);            //付款以前，卖家或买家主动关闭交易,不要对此订单进行发货,切记啊！

        private String context;

        TmSoStatusMap(String context) {
            this.context = context;
        }

        public String getContext() {
            return this.context;
        }
    }

    /****************************** ERP Database Operation *****************/
    /*Process Status*/
    public static final Map<Integer, String> PROC_STATUS = new HashMap<>();

    static {
        PROC_STATUS.put(100, "新建");       //order status
        PROC_STATUS.put(200, "已提交");
        PROC_STATUS.put(250, "已发货");
        PROC_STATUS.put(300, "已确认");
        PROC_STATUS.put(400, "已更新");  //stock status
    }

    /*Stock source*/
    public static final Map<Integer, String> STOCK_SOURCE = new HashMap<>();

    static {
        STOCK_SOURCE.put(100, "手动更新");
        STOCK_SOURCE.put(200, "采购订单");
        STOCK_SOURCE.put(300, "销售订单");
    }
}

